﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace MT.Models.Migrations
{
    public partial class db14 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "StoreGoodsId",
                table: "MedicalChargeDetail",
                nullable: false,
                defaultValue: 0);
            migrationBuilder.Sql("UPDATE medicalchargedetail " +
                " SET medicalchargedetail.storegoodsid = sg.id FROM medicalchargedetail" +
                " mcd JOIN storegoods sg ON sg.goodsid = mcd.goodsid");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "StoreGoodsId",
                table: "MedicalChargeDetail");
        }
    }
}
